package com.itheima.reggie.common;

import lombok.Data;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
public class R<T> {
    private Integer code;//编码:1成功,0失败
    private String msg;//错误信息
    private Object data;//数据

    private Map map = new HashMap();


    public static <T> R<T> success(Object data) {
        R<T> r = new R<T>();
        r.setCode(1);
        r.setData(data);
        r.setMsg("登录成功");
        return r;
    }

    public static <T> R<T> error(String msg) {
        R<T> r = new R<T>();
        r.setCode(0);
        r.setMsg(msg);
        return r;
    }

    public R<T> select(String key, List value){
        this.map.put(key,value);
        return this;
    }




}
